<template>
  <div class="FavorView">
<!--    <button>获取list</button>-->
    <div class="message-box" style="overflow: scroll hidden; height: 100%">
<!--      <span @click="loadMoreData" class="load-more" v-show="showLoadMoreBox">加载更多</span>-->
      <messageItem :key="index" :message-data="item.info" :is-fav="true"
                   v-for="(item, index) in list" :show-alias="false" :show-time="false" ></messageItem>
    </div>
  </div>
</template>

<script>
  import {getFavorList} from "../api/favor";
  import messageItem from '../components/MessageItem';
  export default {
    name: "Favor",
    components: {messageItem},
    data() {
      return {
        showLoadMoreBox: true,
        list: [],
      }
    },
    computed: {
      messageList() {
        return this.list.map((v) => JSON.parse(v.info));
      }
    },
    async mounted() {
      let {list} = await getFavorList();

      this.list = list.map((v) => {
        return {
          ...v,
          info: JSON.parse(v.info)
        }
      });
      console.log(this.list)

    },
    methods: {
      loadMoreData() {

      },

    }
  }
</script>

<style scoped lang="less">
  .FavorView {
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    justify-content: flex-start;
    flex-direction: column;
    .message-box {
      overflow: auto;
      flex: 1 1 auto;
    }
  }
</style>
